package com.fly.main;

import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.fly.demo.service.UserService;

import lombok.extern.slf4j.Slf4j;

/**
 * 
 * Main
 * 
 * @author 00fly
 * @version [版本号, 2018-11-06]
 * @see [相关类/方法]
 * @since [产品/模块版本]
 */
@Slf4j
public class MainRun
{
    /**
     * Main
     * 
     * @param args
     * @see [类、类#方法、类#成员]
     */
    public static void main(String[] args)
    {
        // 写法1
        try (ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("classpath*:application*.xml"))
        {
            // 写法2
            // GenericXmlApplicationContext context = new GenericXmlApplicationContext();
            // context.load("classpath*:application*.xml");
            context.setValidating(false);
            context.refresh();
            UserService usersService = context.getBean(UserService.class);
            log.info("data: {}", usersService.queryAll());
        }
    }
}
